/**
 * Created by 123 on 2017/12/12.
 * 问题集
 */
import callApi from '../utils/callApi'
import apiPath from '../utils/apiPath'

/**
 * 获取问题集分类
 * @returns {Promise.<*>}
 */
export async function queryTroubleCollection() {
  const {json, error} = await callApi(GLOBAL.INT.troubleCollection);

  if (error) {
    return {error: error.message}
  }
  return {res: json}

}

/**
 * 获取问题
 * @param param={pageNo: '页码', pageSize: 条数, categoryId: 问题集children的id}
 * @returns {Promise.<*>}
 */
export async function queryTroubleCollectionItem(param) {
  const {json, error} = await callApi(GLOBAL.INT.troubleCollectionItem, param);

  if (error) {
    return {error: error.message}
  }

  return {res: json}
}